#include <stdio.h>
void hb(int* num1, int m, int* num2, int n)
{
	int l1 = m - 1;
	int l2 = n - 1;
	int l3 = m + n - 1;
	while (l1 >= 0 && l2 >= 0)
	{
		if (num1[l1] < num2[l2])
		{
			num1[l3--] = num2[l2--];
		}
		else
		{
			num1[l3--] = num1[l1--];
		}
	}
	while(l2>=0)
	{
		num1[l3--] = num2[l2--];
	}
}
int main()
{
	int arr1[] = { 1,2,6,9 };
	int arr2[] = { 4,5,7 };
	int m = sizeof(arr1) / sizeof(arr1[0]);
	int n = sizeof(arr2) / sizeof(arr2[0]);
	
	hb(arr1, m, arr2, n);
	for (int i = 0; i < m + n; i++)
	{
		printf("%d ", arr1[i]);
	}
	return 0;
}